package com.personnel.schedule;

import org.springframework.scheduling.annotation.Scheduled;

/**
 * @Author: YuePeng
 * @Date: 2022/4/1 9:46
 * @Version: 1.0
 */
//@Component
public class ScheduledTest {
    // fixedRate = 1000 代表每隔1秒执行一次这个方法
    @Scheduled(fixedRate = 60000)
    public void executeScheduledTask() {
    /*
    Thread.currentThread().getId()     获取当前方法执行的线程id
    Thread.currentThread().getName()   获取当前方法执行的线程名
     */
        System.out.println("executeScheduledTask定时任务，线程ID=" + Thread.currentThread().getId() +
                ",线程名="+Thread.currentThread().getName());
    }
}
